import { http } from '@/utils/https.ts'
import type { loginResult } from '@/types/member'

type LoginParams = {
  /* 小程序登录凭证 */
  code: string
  encryptedData: string
  iv: string
}
  /*
  小程序登录接口
  @param data 请求参数
   */
export const postLoginWxMinAPI = (data: LoginParams) => {
  return http<loginResult>({
    method: 'POST',
    url: '/login/wxMin',
    data,
  })
}

/*
小程序登陆—内测版
 @  POST /login/wxMin/simple
 @  phoneNumber 模拟手机号
 */
export const postLoginWxMinSimpleAPI = (phoneNumber: string) => {
  return http<loginResult>({
    method: 'POST',
    url: '/login/wxMin/simple',
    data: {
      phoneNumber,
    },
  })
}
